home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1998 November: Tool Chest / Dev.CD Nov 98 TC.toast / Sample Code / QuickTime / JPEG Sample / Headers / App.h next >
Encoding:
C/C++ Source or Header  |  1997-03-05  |  5.4 KB  |  222 lines  |  [TEXT/CWIE]

  1. /*************************************************************************************
  2. #
  3. #        App.h
  4. #
  5. #        This file contains the constants and structure definitions.
  6. #
  7. #        Author(s):     Michael Marinkovich & Guillermo Ortiz
  8. #                    marink@apple.com
  9. #
  10. #        Modification History: 
  11. #
  12. #            4/3/96        MWM     Initial coding                     
  13. #
  14. #        Copyright © 1992-96 Apple Computer, Inc., All Rights Reserved
  15. #
  16. #
  17. #        You may incorporate this sample code into your applications without
  18. #        restriction, though the sample code has been provided "AS IS" and the
  19. #        responsibility for its operation is 100% yours.  However, what you are
  20. #        not permitted to do is to redistribute the source as "DSC Sample Code"
  21. #        after having made changes. If you're going to re-distribute the source,
  22. #        we require that you make it clear in the source that the code was
  23. #        descended from Apple Sample Code, but that you've made changes.
  24. #
  25. *************************************************************************************/
  26.  
  27. #include <Printing.h>
  28. #include <QDOffscreen.h>
  29.  
  30.  
  31. //---------------------------------------------------------------------
  32. //
  33. //    JFIF (JPEG) markers
  34. //
  35. //---------------------------------------------------------------------
  36.  
  37. enum {
  38.     kSOFMarker                            = 0xC0,    // Start Of Frame N
  39.     kSOFMarker2                            = 0xC2,
  40.     kDHTMarker                            = 0xC4,    // DHT Marker
  41.     kDACMarker                            = 0xCC,    // DAC
  42.  
  43.     kRSTOMarker                            = 0xD0,    // RSTO marker
  44.     kSOIMarker                            = 0xD8, // Image start marker
  45.     kEOIMarker                            = 0xD9,    // Image end marker
  46.     kSOSMarker                            = 0xDA,    // SOS marker
  47.     kDQTMarker                            = 0xDB,    // DQT marker
  48.  
  49.     kAPPOMarker                            = 0xE0,    // APPO marker
  50.     kCommentMarker                        = 0xFE,    // comment marker
  51.  
  52.     kStartMarker                        = 0xFF    // marker loacted after this byte
  53. };
  54.  
  55.  
  56. //---------------------------------------------------------------------
  57. //
  58. //    Macros
  59. //
  60. //---------------------------------------------------------------------
  61.  
  62. #define MIN(x,y)            ( ((x)<(y)) ? (x) : (y) )
  63. #define MAX(x,y)            ( ((x)>(y)) ? (x) : (y) )
  64. #define TopLeft( r )        ( *(Point *) &(r).top )
  65. #define BotRight( r )        ( *(Point *) &(r).bottom )
  66.  
  67.  
  68. //---------------------------------------------------------------------
  69. //
  70. //    General
  71. //
  72. //---------------------------------------------------------------------
  73.  
  74. #define kMinHeap            300 * 1024
  75. #define kMinSpace            300 * 1024
  76.  
  77.  
  78. //---------------------------------------------------------------------
  79. //
  80. //    Menus
  81. //
  82. //---------------------------------------------------------------------
  83.  
  84. #define rMBarID                128
  85.  
  86. enum {
  87.      mApple                    = 128,
  88.     iAbout                    = 1,
  89.  
  90.     mFile                    = 129,
  91.     iNew                    = 1,
  92.     iOpen                    = 2,
  93.     iSave                    = 3,
  94.     iClose                    = 4,
  95.     iQuit                    = 6
  96. };
  97.  
  98.  
  99. //---------------------------------------------------------------------
  100. //
  101. //    Window stuff
  102. //
  103. //---------------------------------------------------------------------
  104.  
  105. // doc types
  106. enum {
  107.     kDocKind                = 94,
  108.     kDialogKind                = 95,
  109.     kFloatKind                = 96,
  110.     kAboutKind                = 97
  111. };    
  112.  
  113. #define kFudgeFactor        4        // fudge factor for boundary around window
  114. #define kTitleBarHeight        18        // title bar height
  115.  
  116. // scroll values
  117. #define kScrollWidth        15
  118. #define kScrollDelta        16
  119.  
  120.  
  121. //---------------------------------------------------------------------
  122. //
  123. //    General resource ID's
  124. //
  125. //---------------------------------------------------------------------
  126.  
  127. #define rAboutPictID        3000 // about picture
  128. #define rErrorDlg            128     // main error dialog
  129.  
  130.  
  131. //---------------------------------------------------------------------
  132. //
  133. //    Alert Error ID's
  134. //
  135. //---------------------------------------------------------------------
  136.  
  137. #define kNeedsDisplayManager        128    // ID of no Display Manager
  138. #define kNeedsQuickTime                129 // ID of no QuickTime
  139.  
  140. //---------------------------------------------------------------------
  141. //
  142. //    Custom Event Proc stuff
  143. //
  144. //---------------------------------------------------------------------
  145.  
  146. enum {
  147.     kIdleProc            = 1,
  148.     kMenuProc,
  149.     kInContentProc,
  150.     kInGoAwayProc,
  151.     kInZoomProc,
  152.     kInGrowProc,
  153.     kMUpProc,
  154.     kKeyProc,
  155.     kActivateProc,
  156.     kUpdateProc
  157. };
  158.     
  159.  
  160. //---------------------------------------------------------------------
  161. //
  162. //    Typedefs
  163. //
  164. //---------------------------------------------------------------------
  165.  
  166. // event handling proc
  167. typedef void (*CustomProc)(WindowRef window, void *refCon);
  168.  
  169.  
  170. // we just use the basic events for the callback procs
  171.  
  172. struct DocRec
  173. {    
  174.     CustomProc                    idleProc;            // custom idle proc
  175.     CustomProc                    mMenuProc;            // custom menu proc
  176.     CustomProc                    inContentProc;        // custom content click Proc
  177.     CustomProc                    inGoAwayProc;        // custom inGoAway proc
  178.     CustomProc                    inZoomProc;            // custom inZoom proc
  179.     CustomProc                    inGrowProc;            // custom inGrow proc
  180.     CustomProc                    mUpProc;            // custom mouseUp proc
  181.     CustomProc                    keyProc;            // custom autoKey-keyDown proc
  182.     CustomProc                    activateProc;        // custom activate window proc
  183.     CustomProc                    updateProc;            // custom window update proc
  184.     ControlRef                    hScroll;            // horz scroll bar
  185.     ControlRef                    vScroll;            // vert scroll bar
  186.     GWorldPtr                    world;                // offscreen for pict imaging
  187.     PicHandle                    pict;                // windows picture
  188.     THPrint                        printer;            // apps print record - inited at window int
  189.     Boolean                        dirty;                // document needs saving
  190. };
  191.  
  192. typedef struct DocRec DocRec;
  193. typedef DocRec *DocPtr, **DocHnd;
  194.  
  195.  
  196. struct DLDataRec
  197. {    
  198.     long                        refNum;                // ref number of cuurent file
  199.     long                        fileLength;            
  200.     Ptr                            origPtr;            // address of start of buffer;
  201.     Ptr                            endPtr;                // ending address of the buffer
  202. };
  203.  
  204. typedef struct DLDataRec DLDataRec;
  205. typedef DLDataRec *DLDataPtr, **DLDataHnd;
  206.  
  207.  
  208.  
  209.  
  210.  
  211.  
  212.  
  213.  
  214.  
  215.  
  216.  
  217.  
  218.  
  219.  
  220.  
  221.  
  222.